package jjn.round2;

/**
 * @author Jiang Jining
 * @since 2023-05-14 9:21
 */
public class Offer14_1_CutRope {
    public int cuttingRope(int n) {
        int[] dp = new int[n + 1];
        for (int i = 0; i <= n; i++) {
            int curMax = 0;
            for (int j = 0; j < i; j++) {
                curMax = Math.max(curMax, Math.max(j * (i - j), j * dp[i - j]));
            }
            dp[i] = curMax;
        }
        return dp[n];
    }
}
